using System.Collections.Generic;

namespace PalindromeNumber
{
    public class Solution
    {
        public bool IsPalindrome(int x)
        {
            if (x < 0)
                return false;

            var bits = new List<int>();
            while (x > 0)
            {
                bits.Add(x % 10);
                x /= 10;
            }

            for (int i = 0, j = bits.Count - 1; i < j; i++, j--)
                if (bits[i] != bits[j])
                    return false;

            return true;
        }
    }
}